#ifndef LCD_H
#define LCD_H

#include "lcd_global.h"

#include <QTimer>
#include <QRect>
#include <array>
#include "../qlui/paintengine.h"
#include<iostream>


#define lcd_WIDTH 54
#define lcd_HEIGHT 14

class LCDSHARED_EXPORT Lcd: public QObject,public PaintEngine
{
  Q_OBJECT
public:
    Lcd();

    ~Lcd()
    {
        timer_->stop();
        delete timer_;
        timer_ = NULL;
    }
    int writeText(QRect rect, const QString& text, Color fontColor, Color backColor) final;
    int clearRect(QRect rect)   final;
    int clear() final;
public slots:

    void paint();
private:
     QTimer *timer_;
};

#ifdef __cplusplus
extern "C" {
#endif

extern   int lcd_poswrite(const char *str, int x, int y,int type);
extern int      lcd_cursor(int x, int y, int len);
 extern   int    lcd_clear_rect(int x1,  int y1,int x2, int y2) ;
  extern  int  lcd_clear_all() ;
  extern  void  end() ;
  extern int lcd_init();
#ifdef __cplusplus
}
#endif






#endif // LCD_H

